package com.smile.api;

import com.smile.commons.page.R;
import com.smile.model.request.GetUserByIdRequest;
import com.smile.model.request.GetUserInfoByUserNameRequest;
import com.smile.model.response.GetUserByIdResponse;
import com.smile.model.response.GetUserInfoByUserNameResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

@FeignClient(
        name = "smile-plus-standalone-user",
        contextId = "user",
        path = "/api/user"
)
public interface UserApi {

    @PostMapping("/user/getUserInfoByUserName")
    R<GetUserInfoByUserNameResponse> getUserInfoByUserName(
            @RequestBody GetUserInfoByUserNameRequest request
    );

    @PostMapping("/user/system/getUserById")
    R<GetUserByIdResponse> getUserById(@RequestBody GetUserByIdRequest getUserByIdRequest);

    @PostMapping(value = "/user/system/getUserByIds", produces = MediaType.APPLICATION_JSON_VALUE)
    R<Map<Long, GetUserByIdResponse>> getUserByIds(@RequestBody List<Long> ids);

    // 或者使用 @RequestParam（适合GET请求，POST也可以强制用）
    // @PostMapping("/user/getUserById")
    // R<GetUserByIdResponse> getUserById(@RequestParam("id") Long id);
}